package queue;

import java.util.Random;

import linkedList.LinkedListQueue;

public class Main {

	private static double testQueue(Queue<Integer> queue, int opCount) {
		
		long startTime = System.nanoTime();
		
		
		// ...
		Random random = new Random();
		for(int i = 0 ; i < opCount ; i++) {
			queue.enqueue(random.nextInt());
		}
		for(int i = 0 ; i < opCount ; i++) {
			queue.dequeue();
		}
		long endTime = System.nanoTime();
		
		
		return (endTime - startTime) / 1000000000.0;
	}
	public static void main(String[] args) {
//		ArrayQueue<Integer> arrayQueue = new ArrayQueue<Integer>();
//		double time1 = testQueue(arrayQueue,1000000);
//		System.out.println("ArrayQueue,time:"+time1);
		
		LoopQueue<Integer> loopQueue = new LoopQueue<>();
		double time2 = testQueue(loopQueue,1000000);
		System.out.println("LoopQueue,time:"+time2);
		
		LinkedListQueue<Integer> linkedListQueue = new LinkedListQueue<>();
		double time3 = testQueue(linkedListQueue,1000000);
		System.out.println("LinkedListQueue,time:"+time3);
	}

}
